home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Trading on the Edge
/
Trading On The Edge - CD-ROM Toolkit (Wayzata Technology)(2031)(1994).bin
/
pc
/
mac_file
/
vendor_d
/
ga_softw
/
ooga
/
reusable.lis
< prev
next >
Wrap
File List
|
1991-02-03
|
8KB
|
232 lines
;;; -*- Mode:Lisp; Package:OOGA; Base:10; Syntax:COMMON-LISP -*-
#||
RESTRICTED RIGHTS LEGEND
Use, duplication, or disclosure by the Government is subject to
restrictions as set forth in subdivision (b)(3)(ii) of the Rights in
Technical Data and Computer Software Clause at 52.227-7013 of the DOD
FAR Supplement.
TSP (The Software Partnership)
P.O. Box 991
Melrose, MA 02176
Copyright 1990 by Lawrence Davis and Daniel Cerys, all rights reserved.
||#
(in-package :ooga)
#|
This file contains class descriptions for four commonly-used
genetic algorithms: the traditional, binary genetic algorithm;
the steady-state genetic algorithm without duplicates; a
real-number genetic algorithm; and an order-based genetic
algorithm. They are available for specialization, but see the
system documentation for the proper way to use them.
|#
;************************************************************
; TRADITIONAL GENETIC ALGORITHM
;;; Note that this GA is missing several particulars. See the
;;; HOW-TO-EXAMPLES.LISP file for the missing particulars and
;;; how to fill them in.
;;; The traditional GA uses linear-normalization (although there
;;; really is no standard fitness technique), roulette-wheel
;;; parent selection (although Baker's technique is probably
;;; better), binary representation (although some researchers
;;; prefer Gray coding), random initialization,
;;; generational replacement, and the one point crossover and
;;; mutate operator.
;;; A good deal of the research in the genetic algorithm field
;;; has involved modifications of and extensions to
;;; algorithms like this one.
(defclass TRADITIONAL-GA (basic-genetic-algorithm) ())
(def-append-method GET-PARTICULARS ((ga traditional-ga))
`((fitness-technique ,(make-instance 'linear-normalization))
(parent-selection-technique
,(make-instance 'roulette-wheel-parent-selection))
(representation-technique
,(make-instance 'binary-representation))
(initialization-technique
,(make-instance 'random-binary-initialization))
(reproduction-technique
,(make-instance 'generational-replacement))
(deletion-technique ,(make-instance 'delete-all))
(operator-selection-technique
,(make-instance 'use-first-operator))
(operator-list
,(list (make-instance 'one-point-crossover-and-mutate))))
)
;************************************************************
; TRADITIONAL GENETIC ALGORITHM WITH ELITISM
;;; This is a fairly widely-used variant on the traditional
;;; GA.
(defclass TRADITIONAL-GA-WITH-ELITISM (traditional-ga) ())
(def-append-method GET-PARTICULARS ((ga traditional-ga-with-elitism))
(append (call-next-method)
`((reproduction-technique
,(make-instance
'generational-replacement-with-elitism)))))
;************************************************************
; STEADY STATE GA
;;; The STEADY-STATE-GA is a basic GA using
;;; steady-state-without-duplicates and delete-last. It can
;;; be built on to make other more complicated GA's. It cannot
;;; be used for runs until its unspecified slots
;;; have been filled. See the HOW-TO-EXAMPLES.LISP file for
;;; ways to fill these slots.
(defclass STEADY-STATE-GA (basic-genetic-algorithm) ())
(def-append-method GET-PARTICULARS ((ga steady-state-ga))
`((reproduction-technique
,(make-instance 'steady-state-without-duplicates))
(deletion-technique ,(make-instance 'delete-last))))
;************************************************************
; ADVANCED-TECHNIQUES GENETIC ALGORITHM
;;; The advanced-techniques genetic algorithm uses the
;;; steady-state-without-duplicates,
;;; roulette-wheel-parent-selection, linear-normalization, and
;;; roulette-wheel-operator-selection techniques
;;; introduced in the Handbook of Genetic Algorithms.
;;; It is included here so that users who wish to create
;;; algorithms using those techniques can add them simply.
(defclass ADVANCED-TECHNIQUES-GENETIC-ALGORITHM
(steady-state-ga) ())
(defmethod GET-PARTICULARS append
((ga advanced-techniques-genetic-algorithm))
`((parent-selection-technique
,(make-instance 'roulette-wheel-parent-selection))
(fitness-technique ,(make-instance 'linear-normalization))
(operator-selection-technique
,(make-instance 'roulette-wheel-operator-selection))))
;************************************************************
; REAL-VALUED GENETIC ALGORITHM
;;; The real-valued genetic algorithm uses a chromosome
;;; consisting of a list of real numbers. It also uses an
;;; operator list consisting of the five operators used in GA
;;; 5-1. The parameterization of these operators can be
;;; accomplished by creating them oneself on the model of the
;;; operator list in GA 5-1.
;;; Note that the real number mutation operator requires a spec
;;; telling it what the legal range of values for each
;;; chromosome position it. OOGA will match up each spec in
;;; order with its corresponding chromosome position. If OOGA
;;; runs out of specs, it will reuse the last one for each
;;; subsequent chromosome position. This operator also requires
;;; a parameter telling it what the probability is of mutating
;;; any field.
;;; Note that the creep operator requires a spec telling it how
;;; much to creep. The creeping will be a number in this range,
;;; generated from a level distribution. This operator also
;;; requires a parameter telling it what the probability s of
;;; creeping any field. "Big creep" and "little creep"
;;; operators are made by installing higher creep probabilities
;;; and greater creep ranges in the big creep operator, and
;;; smaller ones in the little creep operator.
;;; The list of operator weights is a fairly robust one. You may wish
;;; to add a parameter interpolation method that varies the list
;;; over the course of the run. If you modify the length of the
;;; operator list, you must also modify the length of the
;;; operator weight list.
(defclass REAL-VALUE-GENETIC-ALGORITHM (basic-genetic-algorithm)
())
(def-append-method GET-PARTICULARS ((ga real-value-genetic-algorithm))
`((representation-technique
,(make-instance 'real-number-representation
:real-number-specs '((0 4194303 t))
:chromosome-length 2))
(initialization-technique
,(make-instance 'random-real-number-initialization))
(operator-list
,(list (make-instance 'uniform-list-crossover)
(make-instance 'average-crossover)
(make-instance 'real-number-mutation
:mutation-rate .5
:mutation-specs '((0 4194303 t)))
(make-instance 'real-number-creep
:creep-rate .7
:creep-specs '((70000 t)))
(make-instance 'real-number-creep
:creep-rate .6
:creep-specs '((2000 t)))))
(operator-weights ,(list 10 40 10 30 10))
(reproduction-parameterization-techniques
,(list (make-instance
'interpolate-operator-weights
:interpolation-specs
'((10 40 10 30 10) (10 20 0 40 30)))))))
;************************************************************
; ORDER-BASED GENETIC ALGORITHM
;;; An order-based genetic algorithm uses chromosomes that are
;;; permutations of a basic list. It also uses the
;;; scramble-sublist and uniform-order-based-crossover
;;; operators. The weightings of these operators are those used
;;; in the example in the Handbook of Genetic Algorithms.
;;; Note that the user should define the LIST-TO-PERMUTE method
;;; for any evaluator used with the particulars described below.
;;; The random-permutation initialization technique uses this
;;; method to fill its list-to-permute slot on initialization
;;; for a run.
(defclass ORDER-BASED-GENETIC-ALGORITHM
(basic-genetic-algorithm) ())
(def-append-method GET-PARTICULARS ((ga order-based-genetic-algorithm))
`((representation-technique ,(make-instance 'permuted-list))
(initialization-technique ,(make-instance 'random-permutation))
(operator-list
,(list (make-instance 'uniform-order-based-crossover)
(make-instance 'scramble-sublist-mutation)))
(operator-weights '(60 40))
(reproduction-parameterization-techniques
,(list (make-instance
'interpolate-operator-weights
:interpolation-specs '((70 30) (50 50)))))
(operator-weights ,(list 70 30))))